/*-------------------------------------------------------------------------

***************** Modification History ***********************************
   @doc
   @module isdn.c - Header file for ISDN communications |
   @end
   
$Log: /SoftPay/SPK2SIM/Source/Include/isdn.h $ 
**************************************************************************

   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.

---------------------------------------------------------------------------*/

#include <comm.h>
#include <ict.h>

#ifndef VSISDNH_DEFINED
#define VSISDNH_DEFINED

typedef struct isdn_struct
{
	int         hISDN;              /* Handle of the RS232 Port */
	ICT_REC srICT;
} ISDN_OBJECT;

/* T3POS Protocol Related Definitions */
#define ISDN_T3POS_ATTEMPTS             3
/* Inter-Character Timeout Value (in TICKS, 4 = approx. 50ms) */
#define T3POS_INTER_CHAR_TO             (obISDN->srICT.shInterCharTO*4)

#define LOCAL_MODE_SELECT_SIGNAL        ' '
#define TRANSPARENT_MODE_SELECT_SIGNAL  '!'

#define CALL_CLEAR_SEQUENCE             (-101)

#define ucISDNModeSelectSignal(shMode)      (shMode == ISDN_LOCAL_MODE ? LOCAL_MODE_SELECT_SIGNAL : TRANSPARENT_MODE_SELECT_SIGNAL)

VS_BOOL fGetICTTestTranON (void);
short shGetCurrentISDNMode (void);
int inGetNetworkCause (COMM_OBJECT *obCommunication);
int inISDN_ACK (COMM_OBJECT *obCommunication);
int inSetISDNProtocol (COMM_OBJECT *obCommunication, short shProtocolMode);
int inOpenISDN (COMM_OBJECT *obCommunication);
int inFrameISDNPacket (COMM_OBJECT *obCommunication, char *szPacket, int inPacketSz, char *szData, int inDataLen);
int inEstablishISDNCall (COMM_OBJECT *obCommunication);
int inEndISDNCall (COMM_OBJECT *obCommunication);
int inInitISDNCommunication (COMM_OBJECT *obCommunication);
int inBeginISDNCommunication (COMM_OBJECT *obCommunication, int inCommIndex, VS_BOOL fUnusedParameter);
int inCheckISDNCommunication (COMM_OBJECT *obCommunication);
int inSendISDNCommunication (COMM_OBJECT *obCommunication, char *pchSendBuff, int inSendSize, 
							 VS_BOOL fConfirmSend, int inTimeout, long lnMessage);
int inReceiveISDNCommunication (COMM_OBJECT *obCommunication, char *pchReceiveBuff, 
								int inReceiveSize, int inReceiveTimeout, long lnMessage);
int inFlushISDNCommunication (void);
int inEndISDNCommunication (COMM_OBJECT *obCommunication);
int inDeInitISDNCommunication (COMM_OBJECT *obCommunication);
void vdInitializeISDNComm (COMM_OBJECT *obCommunication);
void vdGetX28SignalData (COMM_OBJECT *obCommunication, char * pszDestination);
void vdGetSecRouteData (COMM_OBJECT *obCommunication, char * pszDestination);
int ISDN_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);

extern int inDeInitCommunication (COMM_OBJECT *);

#endif /* VS_ISDNH */
